<template> 

<h2>注册</h2>
   <table>
       <tr>
           <td>用户名：</td>
           <td><input type="text" v-model="state.username"></td>
       </tr>
       <tr>
           <td>密码：</td>
           <td><input type="password" v-model="state.password"></td>
       </tr>
       <tr>
           <td>时间</td>
           <td><input type="date" v-model="state.mDate"></td>
       </tr>
       <tr>
           <td></td>
           <td><input type="button" value="注册" @click="add" ></td>
       </tr>
   </table>
</template>

<script setup lang="ts">
import { reactive, toRefs } from 'vue';
import axios from 'axios';
let data = reactive({
    state: {
        username: '',
        password: '',
        mDate:''
    }
})
let { state } = toRefs(data)
const add = () => {
    let obj = {
        mId: 0,
  mName: state.value.username,
  pwd: state.value.password,
  mDate: state.value.mDate
    }
    axios({
        url: '/api/Member/MemeberAdd',
        method: 'post',
        data: obj
    })
        .then(res => {
            console.log(res)
            if (res.data == 1) {
                alert("注册成功")
            }
            else {
                alert("注册失败")
            }
        })
        .catch(err=>{
            console.log(err)
        })
}
</script>

<style scoped>

</style>